function sendRequest_callback() {
    alert ( xhttp.readyState);

    if (xhttp.readyState==4 && xhttp.status==200)
	alert ( xhttp.responseText );
}

function createXMLHttpRequest() {
    if (window.ActiveXObject) {
	try {
	    // IE 6 and higher
	    xhttp = new ActiveXObject("MSXML2.XMLHTTP");
	} catch (e) {
	    try {
		// IE 5
		xhttp = new ActiveXObject("Microsoft.XMLHTTP");
	    } catch (e) {
		xhttp=false;
	    }
	}
    }
    else if (window.XMLHttpRequest) {
	try {
	    // Mozilla, Opera, Safari ...
	    xhttp = new XMLHttpRequest();
	} catch (e) {
	    xhttp=false;
	}
    }
}
function getStundenabrechnung(str) {
    if (!xhttp) {
    	alert("An Error occured when trying to initialize XMLHttpRequest!");
    	return; // exit
    }
    var url = "http://www.philo.uni-saarland.de/intern/stunden/get_GrpByMA.php";
    var q = encodeURIComponent(str);
    xhttp.open("GET",url+"?q="+q,true);
    xhttp.onreadystatechange = sendRequest_callback;
    xhttp.send(null);
}


function sendRequest_callback() {
    switch (xhttp.readyState) {
	// wenn der readyState 4 und der request.status 200 ist, dann ist alles korrekt gelaufen
	case 4:
	    if (xhttp.status != 200) {
		alert("Request completed with errors: "+request.status);
	    } else {
		// den Inhalt des Requests in das <div> schreiben
		document.getElementById('basics').innerHTML = xhttp.responseText;
	    }
	    break;
	default:
	    break;
    }
}

function init() {
    createXMLHttpRequest();
}
window.onload=init;